package com.atguigu.rabbitmq.springbootrabbitmq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ConfirmConfig {
    public static final String CONFIRM_EXCHANGE_NAME="confirm_exchange";
    public static final String QUEUE_NAME="confirm_queue";
    public static final String  CONFIRM_ROUTING_KEY="key1";
    @Bean
    public DirectExchange confirmExchange(){
        return new DirectExchange(CONFIRM_EXCHANGE_NAME);
    }
    @Bean
    public Queue confirmQueue(){
        return QueueBuilder.durable(QUEUE_NAME).build();
    }
    @Bean
    public Binding QUEUEBingEXCHANGE(){
        return BindingBuilder.bind(confirmQueue()).to(confirmExchange()).with(CONFIRM_ROUTING_KEY);
    }

}
